package com.notifier.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * 错误事件发布器
 *
 * @author Amadeus
 * @date 2025/10/14
 */
@Slf4j
@Component
public class ErrorEventPublisher {
    
    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;
    
    /**
     * 发布错误事件
     */
    public void publish(ErrorEvent errorEvent) {
        try {
            applicationEventPublisher.publishEvent(errorEvent);
        } catch (Exception e) {
            log.warn("发布错误事件失败", e);
        }
    }
}

